#include <bits/stdc++.h>
#define lli long long int
#define ii pair<lli,int>
#define fi first
#define se second
#define vec vector<lli>
using namespace std;
int main () ///
{
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n; cin>>n;
char a[n+1][n+1];
bool check[n+1][n+1], flag=true;
for (int i=1;i<=n;i++) for (int j=1;j<=n;j++) cin>>a[i][j], check[i][j]=false;
for (int i=1;i<=n;i++) for (int j=1;j<=n;j++)
{
if (a[i][j]=='#' && !check[i][j])
{
check[i][j]=true;
int dem=0;
if (i<n && a[i+1][j]=='#' && !check[i+1][j]) dem++, check[i+1][j]=true;
if (i<n && j>1 && a[i+1][j-1]=='#' && !check[i+1][j-1]) dem++, check[i+1][j-1]=true;
if (i<n && j<n && a[i+1][j+1]=='#' && !check[i+1][j+1]) dem++, check[i+1][j+1]=true;
if (i+1<n && a[i+2][j]=='#' && !check[i+2][j]) dem++, check[i+2][j]=true;
if (dem!=4) {flag=false; break;}
}
}
if (flag) cout<<"YES"; else cout<<"NO";
}
1343C - Alternating Subsequence | 1325A - EhAb AnD gCd |
746A - Compote | 318A - Even Odds |
550B - Preparing Olympiad | 939B - Hamster Farm |
732A - Buy a Shovel | 1220C - Substring Game in the Lesson |
452A - Eevee | 1647B - Madoka and the Elegant Gift |
1408A - Circle Coloring | 766B - Mahmoud and a Triangle |
1618C - Paint the Array | 469A - I Wanna Be the Guy |
1294A - Collecting Coins | 1227A - Math Problem |
349A - Cinema Line | 47A - Triangular numbers |
1516B - AGAGA XOOORRR | 1515A - Phoenix and Gold |
1515B - Phoenix and Puzzle | 155A - I_love_username |
49A - Sleuth | 1541A - Pretty Permutations |
1632C - Strange Test | 673A - Bear and Game |
276A - Lunch Rush | 1205A - Almost Equal |
1020B - Badge | 1353A - Most Unstable Array |